<template>
  <div class="app-container">
    <el-card class="box-card" shadow="always" v-show="showSearch">
      <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px" @submit.native.prevent>
        <el-form-item label="回访人" prop="addBy">
          <el-select
            v-model="queryParams.addBy"
            filterable
            clearable
            remote
            reserve-keyword
            placeholder="请选择回访人"
            :loading="loading"
            @change="handleQuery"
          >
            <el-option v-for="item in userList" :key="item.value" :label="item.realityName" :value="item.userId" />
          </el-select>
        </el-form-item>
        <el-form-item label="订单编号" prop="orderNo">
          <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable @keyup.enter="handleQuery" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery">搜索</el-button>
          <el-button @click="resetQuery">重置</el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <el-card shadow="always" :body-style="{ padding: '20px' }" style="margin-top: 10px">
      <el-row :gutter="10" class="mb8">
        <!-- <el-col :span="1.5">
                    <el-button type="primary" @click="handleAdd" v-hasPermi="['order:ordersReturn:add']">新增
                    </el-button>
                </el-col> -->
        <el-col :span="1.5">
          <el-button type="danger" :disabled="!multiple" @click="handleBatchDelete" v-hasPermi="['order:ordersReturn:remove']">删除 </el-button>
        </el-col>
        <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
      </el-row>

      <el-table v-loading="loading" border :data="dataSource" @selection-change="handleSelectionChange" size="large">
        <el-table-column type="selection" width="55" align="center" :selectable="selectHandle" />
        <el-table-column label="序号" type="index" width="60"> </el-table-column>
        <el-table-column label="订单编号" align="center" prop="orderNo" width="200">
          <template #default="scope">
            <a style="color: #409eff; cursor: pointer" @click="handleDetail(scope.row)">{{ scope.row.orderNo }}</a>
          </template>
        </el-table-column>
        <el-table-column label="回访内容记录" align="center" prop="content" />
        <el-table-column label="回访人" align="center" prop="addByName" width="200" />
        <el-table-column label="回访时间" align="center" prop="addTime" width="180" />
        <el-table-column label="操作" align="center" fixed="right" width="150">
          <template #default="scope">
            <!-- <el-button type="text" @click="handleEdit(scope.row)"
                            v-hasPermi="['order:ordersReturn:edit']">编辑</el-button>
                        <el-divider direction="vertical"></el-divider> -->
            <el-button type="text" @click="handleDelete(scope.row.id)" v-hasPermi="['order:ordersReturn:remove']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total > 0"
        :total="total"
        v-model:page.sync="queryParams.pageNum"
        v-model:limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </el-card>
    <addForm ref="modelForm" @ok="getList"></addForm>
  </div>
</template>

<script>
import addForm from './modules/addForm.vue';
import listMixin from '@/mixins/listMixin';
export default {
  name: 'tips',
  dicts: ['inventory_status', 'counting_method'],
  components: {
    addForm
  },
  mixins: [listMixin],
  data() {
    return {
      queryParams: {
        orderNo: '',
        pageNum: 1,
        pageSize: 10
      },
      urls: {
        list: '/order/ordersReturn/list',
        delete: '/order/ordersReturn'
      }
    };
  },
  mounted() {
    this.listSysUser();
  },
  methods: {
    handleDetail(row) {
      // this.$router.push({
      //     path:`/order/order_detail`,
      //     params:{
      //         id:id
      //     }
      // })
      window.open(`/order/order_detail?id=${row.id}`, '_blank');
    }
  }
};
</script>